<style scoped>
  .weui-media-box_appmsg .weui-media-box__hd {
    font-size: 12px;
    /*background: #ccc;*/
    color: #fff;
  }
  .weui-media-box_appmsg .weui-media-box__hd .blue {
    background: #296BCC !important;
  }
  .weui-media-box__desc {
    font-size: 12px;
  }
  .weui-media-box__title {
    white-space: normal;
    font-size: 14px;
    margin-bottom: 5px;
  }
  .weui-form-preview__bd {
    text-align: left;
  }

  .weui-form-preview {
    position: relative;
    background-color: #fff;
    margin: 1%;
    border-radius: 5px;
  }
  .time {
    position: absolute;
    right: 15px;
    top: 0;
    font-size: 10px;
    color: #ccc;
  }

  .logimg {
    width: 14px;
    height: 14px;
  }
  .datalist {
    background: #e3e3e3;
    height: 100%;
    overflow: hidden;
  }
  .datalist.nodata {
    font-size: 14px;
    padding: 5px;
  }
  .tit {
    font-size: 12px;
    text-align: left;
    padding: 5px 15px 0 30px;
  }

  .weui-media-box_appmsg {
    /*display: block !important;*/
    font-size: 0;
  }
  .weui-media-box_appmsg .weui-media-box__hd {
    margin-right: 5% !important;
    width: 23%;
    height: 23%;
    white-space: nowrap;
    /*line-height: 23%;*/
    display: inline-block !important;
  }
  .weui-media-box_appmsg .weui-media-box__bd {
    display: inline-block !important;
    width: 71%;
  }
  .weui-media-box__desc {
    overflow: initial;
    line-height: 1.4;
    display: flex;
  }
  .weui-media-box_appmsg .weui-media-box__hd .nodenm{
    width: 50px;
    height: 50px;
    line-height: 50px;
    border-radius: 50%;
    background: #ccc;
    margin: 0 auto;
    font-size: 10px;
  }
  .weui-media-box {
    padding: 0 !important;
  }

  .delsty {
    position: absolute;
    top: -10px;
    right: -15px;
    /*z-index: 1000;*/
  }
  .icontbox {
    font-size: 0;
    width: 95%;
  }
  .contbox-txt {
    font-size: 10px; color: #ccc;
    text-align: right;
  }


  .weui_uploader_input_wrp {
    float: left;
    position: relative;
    margin-right: 9px;
    margin-bottom: 9px;
    width: 77px;
    height: 77px;
    border: 1px solid #D9D9D9;
  }

  .weui_uploader_files {
    list-style: none;
  }

  .weui_uploader_input_wrp:before {
    width: 2px;
    height: 39.5px;
  }

  .weui_uploader_input_wrp:before, .weui_uploader_input_wrp:after {
    content: " ";
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    background-color: #D9D9D9;
  }

  .weui_uploader_input {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  }

  .weui_uploader_input_wrp:after {
    width: 39.5px;
    height: 2px;
  }

  .weui_uploader_bd {
    overflow: hidden;
  }
  .outstore >>> .weui-uploader_file {
    float: left;
    margin-right: 9px;
    margin-bottom: 9px;
    width: 79px;
    background: no-repeat 50%;
    background-size: cover;
  }

  .weui-cell.fir {
    border-top: 0;
  }
  .weui_uploader_input_wrp.inrow {
    width: 30px;
    height: 30px;
    margin: 0;
  }

  .weui_uploader_input_wrp:before {
    height: 19.5px;
  }

  .weui_uploader_input_wrp:after {
    width: 19.5px;
  }

  .weui-uploader_file.inrow {
    margin: 0;
    width: 40px;
  }

  li.weui-uploader_file {
    display: inline-block;
    padding: 3px 5px;
  }

  ul#images {
    text-align: right;
  }
</style>
<template>
  <div class="weui-tabbar">
    <a href="javascript:;" class="weui-tabbar__item weui-bar__item--on subbtn" @click="postForm">
      <div class="weui-tabbar__icon">
        <img src="@/assets/icon-pass.png" alt="">
      </div>
      <p class="weui-tabbar__label">通过</p>
    </a>
    <a href="javascript:;" class="weui-tabbar__item" @click="rejectIt">
      <div class="weui-tabbar__icon">
        <img src="@/assets/icon-nopass.png" alt="">
      </div>
      <p class="weui-tabbar__label">拒绝</p>
    </a>
    <a href="javascript:;" class="weui-tabbar__item" @click="commentIt">
      <div class="weui-tabbar__icon">
        <img src="@/assets/icon-comment.png" alt="">
      </div>
      <p class="weui-tabbar__label">评论</p>
    </a>
    <a href="javascript:;" class="weui-tabbar__item" @click="transferIt">
      <div class="weui-tabbar__icon">
        <img src="@/assets/icon-transfer.png" alt="">
      </div>
      <p class="weui-tabbar__label">转交</p>
    </a>
    <a href="javascript:;" class="weui-tabbar__item" @click="shareIt">
      <div class="weui-tabbar__icon">
        <img src="@/assets/icon-share3.png" alt="">
      </div>
      <p class="weui-tabbar__label">分享</p>
    </a>
  </div>
</template>

<script>
  import qs from 'qs';
  export default {
    name: 'ApproveBom',
    data () {
      return {
        submitStat: false,
        refuseNodes: []
      }
    },
    props: [
      'type',
      'id',
      'srguid',
      'departid',
      'model',
      'opinion',
      'fileids',
      'passUrl',
      'refuseUrl',
      'navgateUrl',
      'refuseflag',
      'annex',
      'flowid',
      'nodeid'
    ],
    components: {
    },
    watch: {
      model: {
        immediate: true,
        handler: function(value) {
          console.log('model value:', value)
        }
      },
    },
    mounted() {
    },
    methods: {
      rejectIt: function () {
        if (this.refuseflag == 1) {
          this.$router.push({name: 'Refuse', query: {id: this.id, nodeid: this.nodeid, refuseUrl: this.refuseUrl, navgateUrl: this.navgateUrl}});
        } else {
          this.toastText('不可拒绝!');
        }
      },
      commentIt: function () {
        this.$router.push({name: 'Comment', query: {id: this.id, flowid: this.flowid, nodeid: this.nodeid, srguid: this.srguid, departid: this.departid, navgateUrl: this.navgateUrl}});
      },
      transferIt: function () {
        this.$router.push({name: 'Transfer', query: {id: this.id, nodeid: this.nodeid, flowid: this.flowid, navgateUrl: this.navgateUrl}});
      },
      shareIt: function () {
        this.$router.push({name: 'Share', query: {id: this.id, flowid: this.flowid, navgateUrl: this.navgateUrl}});
      },
      postForm: function () {
        let that = this;
        if (that.type == 'purchaseFdRm') {
          if (that.model.items.some(item => !item.shrguid)) {
            this.toastText('请选择库间');
            return;
          }
        }
        if (that.type == 'transFinance27') {
          if (!that.model.quality) {
            this.toastText('请选择单据性质');
            return;
          }
        }
        if (that.type == 'transFinance') {
          if (that.model.items.some(item => !item.interSettlPrice)) {
            this.toastText('请填写内部价格');
            return;
          }
        }
        if (that.type == 'transSendcar' || that.type == 'sellSendcar') {
          console.log('this.model:', this.model)
          //物流公司
          if (!this.model.customername) {
            this.toastText("请选择物流公司");
            return false;
          }
          if (this.model.transtype != 3) {
            if (!this.model.drivername) {
              this.toastText("请填写司机姓名");
              return false;
            }
            if (!this.model.driverphone) {
              this.toastText("请填写司机电话");
              return false;
            }
            if (!this.model.carcode) {
              this.toastText("请填写车牌号");
              return false;
            }
            if (!this.model.faretype) {
              this.toastText("请选择结算方式");
              return false;
            }
            if (!this.model.farepricetype) {
              this.toastText("请选择运价方式");
              return false;
            }
            if (!this.model.fareprice) {
              this.toastText("请填写运价");
              return false;
            }
            if (!this.model.delicontact) {
              this.toastText("请填写发货联系人");
              return false;
            }
            if (!this.model.delicontacttel) {
              this.toastText("请填写发货联系人手机号");
              return false;
            }
            if (!this.model.deliprovince) {
              this.toastText("请填写发货地址");
              return false;
            }
            if (!this.model.deliaddress) {
              this.toastText("请填写发货详细地址");
              return false;
            }
            if (!this.model.arricontact) {
              this.toastText("请填写收货联系人");
              return false;
            }
            if (!this.model.arricontactno) {
              this.toastText("请填写收货联系人手机号");
              return false;
            }
            if (!this.model.arriprovince) {
              this.toastText("请填写收货地址");
              return false;
            }
            if (!this.model.arriaddres) {
              this.toastText("请填写详细收货地址");
              return false;
            }
          }
          // if ($("#farepricetype").val() == 0) {
          //   this.toastText("请选择运价方式");
          //   return false;
          // }
          // if ($("#fareprice").val() == 0) {
          //   this.toastText("请输入运价");
          //   return false;
          // }
        }
        if (that.type == 'transOut') {
          if (that.model.items.some(item => !item.shrguid)) {
            this.toastText('请选择库间');
            return;
          }
          if (that.model.items.some(item => !item.weight)) {
            this.toastText('货品明细重量有误');
            return;
          }
          // if (that.model.items.some(item => parseFloat(item.weight) > parseFloat(item.shiftweight)*1.1 || parseFloat(item.weight) < parseFloat(item.shiftweight)*0.9 )) {
          //   this.toastText('货品明细重量有误，请检查！');
          //   return;
          // }
        }
        if (that.type == 'sellOut') {
          console.log('that.model:', that.model)
          if (that.model.items.some(item => !item.shrguid)) {
            this.toastText('请选择库间');
            return;
          }
          if (that.model.items.some(item => !item.weight)) {
            this.toastText('货品明细重量有误');
            return;
          }
          // if (that.model.items.some(item => item.loadcount > item.weight + item.handselcount)) {
          //   this.toastText('出库数量不能大于订单数量+赠送数量');
          //   return;
          // }
          // if (this.model.totalRealWei > this.model.orderweight + parseFloat(this.model.weightx * this.model.orderweight)) {
          //   this.toastText('出库重量有误，不允许大于订单重量：'+ this.model.orderweight +' + 系统设定浮动重量：' + this.toFix6(this.model.weightx * this.model.orderweight) + '(=' + this.model.weightx + '*' + this.model.orderweight + ')');
          //   return false;
          // }
          if (this.annex && this.annex.indexOf('whout') > -1 && this.fileids && this.fileids.length <= 0) {
            this.toastText('请上传出库单！');
            return false;
          }
        }
        if (that.type == 'sellSettle') {
          if(!that.model.finalamount){
            this.toastText('结算金额不能为空');
            return false;
          }
        }
        if (that.type == 'transIn') {
          if (that.model.items.some(item => !item.shrguid)) {
            this.toastText('请选择库间');
            return;
          }
          if (that.model.items.some(item => !item.weight)) {
            this.toastText('货品明细重量有误');
            return;
          }
          if (that.model.items.some(item => item.weight > item.whoutWei * (1 + that.model.weightx) || item.weight < item.whoutWei * (1 - that.model.weightx)) ) {
            this.toastText('货品明细数量超出系统设定浮动范围，请检查！');
            return;
          }
        }
        if (['applySrFeed', 'pickOutSr', 'backFeed'].includes(that.type)) {
          console.log('that.model:', that.model)
          if (that.model.items.some(item => !item.shrguid)) {
            this.toastText('请选择库间');
            return;
          }
          if (that.model.items.some(item => !item.weight)) {
            this.toastText('货品明细数量有误');
            return;
          }
        }
        if (that.type == 'sellDispatch') {
          console.log('that.model:', that.model)
          if(!that.model.storeOrgId){
            this.toastText('请选择库存组织');
            return false;
          }
          if(!that.model.storermguid){
            this.toastText('请选择库房');
            return false;
          }
          if(!that.model.deliProvince){
            this.toastText('请选择发货地址');
            return false;
          }
          if(!that.model.deliAddress){
            this.toastText('请填写发货详细地址');
            return false;
          }
          if(!that.model.deliContact){
            this.toastText('请填写发货联系人');
            return false;
          }
          if(!that.model.deliContactNo){
            this.toastText('请填写发货联系人手机号');
            return false;
          }
        }
        if (that.type == 'sellSplit') {
          if(!that.model.settledays){
            this.toastText('请选择调度类型');
            return false;
          }
          // if ([1,2,3].includes(parseInt(that.model.settledays))) {
          if ([1,2].includes(parseInt(that.model.settledays))) {
            if(!that.model.storermguid){
              this.toastText('请选择出库库房');
              return false;
            }
          }
          // if ([2,3].includes(parseInt(that.model.settledays))) {
          if ([2].includes(parseInt(that.model.settledays))) {
            // if(that.model.settletype == 1 && that.model.items.some(item => !parseFloat(item.orderpack))){
            //   this.toastText('请填写订单数量');
            //   return false;
            // }
            // if(that.model.settletype == 1 && that.model.items.some(item => parseFloat(item.orderpack) > item.unFinishCount)){
            //   this.toastText('分拆订单数量不允许大于主订单未处理数量！');
            //   return false;
            // }
            // if(that.model.settletype == 1 && that.model.items.some(item => parseFloat(item.handselcount) > item.unFnsHandsCount)){
            //   this.toastText('分拆订单赠送数量不允许大于主订单未赠送数量！');
            //   return false;
            // }
            if(that.model.items.some(item => !parseFloat(item.weight))){
              this.toastText('请填写订单重量');
              return false;
            }
            if(that.model.items.some(item => parseFloat(item.weight) > item.unFinishCount)){
              this.toastText('分拆订单重量不允许大于主订单未处理重量!');
              return false;
            }
            if(that.model.items.some(item => parseFloat(item.handselcount) > item.unFnsHandsCount)){
              this.toastText('分拆订单赠送数量不允许大于主订单未赠送数量！');
              return false;
            }
          }
        }
        if (that.type == 'forderWeigh') {
          if(!that.model.weight){
            that.toastText('请输入过磅重量');
            return false;
          }
        }
        if (that.type == 'forderWhin') {
          if(!that.model.hweight){
            that.toastText('请输入过磅重量');
            return false;
          }
          if(that.model.pkgWeiAllowed != 0 && that.model.wghtperpkg === ''){
            that.toastText('请输入单位净重');
            return false;
          }
          if(that.model.pkgWeiAllowed != 0 && that.model.pkgwgh === ''){
            that.toastText('请输入包装物重量');
            return false;
          }
          if(!that.model.sthguid){
            that.toastText('库间不能为空');
            return false;
          }
        }
        if (that.type == 'forderQacheck') {
          if(that.model.refuseFlag == 1 && that.model.isdiscount != 1 && that.model.deductRateByCheck == null){
            that.toastText('尚未进行质检操作');
            return false;
          }
          if(!that.model.refuseFlag){
            that.toastText('请选择是否接收');
            return false;
          }
          if(that.model.refuseFlag == 2 && !that.opinion){
            that.toastText('拒收意见不能为空');
            return false;
          }
        }
        if (that.type == 'forderConfirm') {
          if(!that.model.cartype){
            that.toastText('请选择车型');
            return false;
          }
          if (this.model.type == 2 && !this.model.price) {
            this.toastText('请录入合同单价');
            return;
          }
          if(!that.model.refuseFlag){
            that.toastText('请选择是否接收');
            return false;
          }
          if(that.model.refuseFlag == 2 && !that.opinion){
            that.toastText('拒收意见不能为空');
            return false;
          }
        }
        if (that.type == 'Finance41') {
          if(!that.model.invoiceOn){
            that.toastText('请选择是否收到发票');
            return false;
          }
        }
        // if (that.type == 'Pay41') {
        //   if(!that.model.applyAmount){
        //     that.toastText('支付金额不能为空');
        //     return false;
        //   }
        // }
        if (that.type == 'FinalPay41') {
          if(!that.model.applyAmount){
            that.toastText('支付金额不能为空');
            return false;
          }
          if(that.model.applyAmount > that.toNum(that.model.recamount)){
            that.toastText('支付金额不能大于未付金额');
            return false;
          }
        }
        if (this.annex && this.annex.indexOf('approval') > -1 && this.fileids && this.fileids.length <= 0) {
          this.toastText('单据不能为空！');
          return false;
        }
        let splitItems = that.model.items;
        $.confirm("确定要审批通过?", function() {
          console.log('splitItems:', splitItems)
          //防止重复提交
          $('.weui-dialog__btn').attr("disabled",true).css("pointer-events","none");
          //显示提交状态
          $.showLoading("正在提交");

          if (that.type == 'purchaseFdRm') {
            let postData = {
              fileIds: that.fileids ? that.fileids.join(',') : '',
              id: that.id,
              opinion: that.opinion || '同意',
              taskid: that.nodeid
            };
            let items = that.model.items.map(item => {
              let aItem = {};
              aItem.applyitemid = item.guid;
              aItem.productguid = item.productguid;
              aItem.spguid = item.spguid;
              aItem.shrguid = item.shrguid;
              aItem.weight = item.count;
              return aItem;
            })
            let base = {
              whinitems: items
            }
            that.axios({
              method: 'post',
              url: `${that.passUrl}?${qs.stringify(postData)}`,
              data: base
            }).then(response => {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();

              if (response.data.code == 200) {
                that.toastSuccess('提交成功!');
                that.$router.push({ path: that.navgateUrl })
              } else if (response.data.msg) {
                that.toastText(response.data.msg);
              } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
                //不不设置提示
              } else {
                that.toastError('系统错误');
              }
            }).catch(function (error) {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();
              that.toastError('系统错误');
            });
            console.log('postData.items:', postData.items)
          } else if (that.type == 'transIn') {
            let postData = {
              fileIds: that.fileids ? that.fileids.join(',') : '',
              id: that.id,
              opinion: that.opinion || '同意',
              taskid: that.nodeid
            };
            let items = that.model.items.map(item => {
              let aItem = {};
              aItem.applyitemid = item.guid;
              aItem.productguid = item.productguid;
              aItem.spguid = item.spguid;
              aItem.stockunitid = item.stockunitid;
              aItem.stockunit = item.stockunit;
              aItem.shrguid = item.shrguid;
              aItem.weight = item.weight;
              return aItem;
            })
            let base = {
              itemsIn: items
            }
            that.axios({
              method: 'post',
              url: `${that.passUrl}?${qs.stringify(postData)}`,
              data: base
            }).then(response => {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();

              if (response.data.code == 200) {
                that.toastSuccess('提交成功!');
                that.$router.push({ path: that.navgateUrl })
              } else if (response.data.msg) {
                that.toastText(response.data.msg);
              } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
                //不不设置提示
              } else {
                that.toastError('系统错误');
              }
            }).catch(function (error) {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();
              that.toastError('系统错误');
            });
            console.log('postData.items:', postData.items)
          } else if ('transOut' == that.type) {
            let postData = {
              fileIds: that.fileids ? that.fileids.join(',') : '',
              id: that.id,
              opinion: that.opinion || '同意',
              taskid: that.nodeid
            };
            let items = that.model.items.map(item => {
              let aItem = {};
              aItem.scrapitemid = item.guid;
              aItem.productguid = item.productguid;
              aItem.spguid = item.spguid;
              aItem.rawspguid = item.spguid;
              aItem.stockunitid = item.stockunitid;
              aItem.stockunit = item.stockunit;
              aItem.shrguid = item.shrguid;
              aItem.weight = item.weight;
              return aItem;
            })
            let base = {
              itemsOut: items
            }
            that.axios({
              method: 'post',
              url: `${that.passUrl}?${qs.stringify(postData)}`,
              data: base
            }).then(response => {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();

              if (response.data.code == 200) {
                that.toastSuccess('提交成功!');
                that.$router.push({ path: that.navgateUrl })
              } else if (response.data.msg) {
                that.toastText(response.data.msg);
              } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
                //不不设置提示
              } else {
                that.toastError('系统错误');
              }
            }).catch(function (error) {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();
              that.toastError('系统错误');
            });
            console.log('postData.items:', postData.items)
          } else if (['transFinance'].includes(that.type)) {
            let postData = {
              fileIds: that.fileids ? that.fileids.join(',') : '',
              id: that.id,
              opinion: that.opinion || '同意',
              taskid: that.nodeid
            };
            let base = {
              items: that.model.items
            }
            that.axios({
              method: 'post',
              url: `${that.passUrl}?${qs.stringify(postData)}`,
              data: base
            }).then(response => {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();

              if (response.data.code == 200) {
                that.toastSuccess('提交成功!');
                that.$router.push({ path: that.navgateUrl })
              } else if (response.data.msg) {
                that.toastText(response.data.msg);
              } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
                //不不设置提示
              } else {
                that.toastError('系统错误');
              }
            }).catch(function (error) {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();
              that.toastError('系统错误');
            });
          } else if (that.type == 'transFinance27') {
            let postData = {
              fileIds: that.fileids ? that.fileids.join(',') : '',
              id: that.id,
              opinion: that.opinion || '同意',
              taskid: that.nodeid,
              quality: that.model.quality
            };
            let base = {
              items: that.model.items
            }
            that.axios({
              method: 'post',
              url: `${that.passUrl}?${qs.stringify(postData)}`,
              data: base
            }).then(response => {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();

              if (response.data.code == 200) {
                that.toastSuccess('提交成功!');
                that.$router.push({ path: that.navgateUrl })
              } else if (response.data.msg) {
                that.toastText(response.data.msg);
              } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
                //不不设置提示
              } else {
                that.toastError('系统错误');
              }
            }).catch(function (error) {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();
              that.toastError('系统错误');
            });
          } else if (that.type == 'transSendcar' || that.type == 'sellSendcar') {
            let model = that.model;
            if (model.pingche) {
              model.pingche = 1;
              model.wlinfoId = that.model.existOrderId;
            } else {
              model.pingche = 0;
              Reflect.deleteProperty(model, 'wlinfoId')
            }
            let postData = {
              fileIds: that.fileids ? that.fileids.join(',') : '',
              id: that.id,
              opinion: that.opinion || '同意',
              taskid: that.nodeid
            };
            that.axios({
              method: 'post',
              url: `${that.passUrl}?${qs.stringify(postData)}`,
              data: model
            }).then(response => {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();

              if (response.data.code == 200) {
                that.toastSuccess('提交成功!');
                that.$router.push({ path: that.navgateUrl })
              } else if (response.data.msg) {
                that.toastText(response.data.msg);
              } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
                //不不设置提示
              } else {
                that.toastError('系统错误');
              }
            }).catch(function (error) {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();
              that.toastError('系统错误');
            });
          } else if (that.type == 'sellSplit') {
            let model = JSON.parse(JSON.stringify(that.model));
            console.log('model：', model)
            // if ([2,3].includes(parseInt(that.model.settledays))) {
            if ([2].includes(parseInt(that.model.settledays))) {
              model.items = splitItems.filter(item => item.type == "item");
              model.spitems = splitItems.filter(item => item.type == "spitem");
            } else {
              model.items = null;
            }
            let postData = {
              fileIds: that.fileids ? that.fileids.join(',') : '',
              id: that.id,
              opinion: that.opinion || '同意',
              taskid: that.nodeid,
              partitiontype: model.partitiontype
            };
            that.axios({
              method: 'post',
              url: `${that.passUrl}?${qs.stringify(postData)}`,
              data: model
            }).then(response => {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();

              if (response.data.code == 200) {
                that.toastSuccess('提交成功!');
                that.$router.push({ path: that.navgateUrl })
              } else if (response.data.msg == "yz") {
                let result = response.data.result;
                let txt = '预收款余额不足</br>余额：' + result.prebalance + '</br>在途订单：' + result.ztbalance + '</br>可用余额：' + result.kybalance + '</br>当前订单：' + result.balance;
                that.toastText5(txt);
              } else if (response.data.msg) {
                that.toastText(response.data.msg);
              } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
                //不不设置提示
              } else {
                that.toastError('系统错误');
              }
            }).catch(function (error) {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();
              that.toastError('系统错误');
            });
            console.log('postData.items:', postData.items)
          } else if (['applySrFeed', 'pickOutSr', 'backFeed'].includes(that.type)) {
            let postData = {
              fileIds: that.fileids ? that.fileids.join(',') : '',
              id: that.id,
              opinion: that.opinion || '同意',
              taskid: that.nodeid,
              opttype: 4
            };
            let items = that.model.items;
            let base = {
              items: items
            }
            that.axios({
              method: 'post',
              url: `${that.passUrl}?${qs.stringify(postData)}`,
              data: base
            }).then(response => {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();

              if (response.data.code == 200) {
                that.toastSuccess('提交成功!');
                that.$router.push({ path: that.navgateUrl })
              } else if (response.data.msg) {
                that.toastText(response.data.msg);
              } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
                //不不设置提示
              } else {
                that.toastError('系统错误');
              }
            }).catch(function (error) {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();
              that.toastError('系统错误');
            });
            console.log('postData.items:', postData.items)
          } else if (['sellOut', 'sellSettle'].includes(that.type)) {
            let postData = {
              fileIds: that.fileids ? that.fileids.join(',') : '',
              id: that.id,
              opinion: that.opinion || '同意',
              taskid: that.nodeid,
              opttype: 2,
              backFlag: that.model.backFlag
            };
            that.axios({
              method: 'post',
              url: `${that.passUrl}?${qs.stringify(postData)}`,
              data: that.model
            }).then(response => {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();

              if (response.data.code == 200) {
                that.toastSuccess('提交成功!');
                that.$router.push({ path: that.navgateUrl })
              } else if (response.data.msg) {
                that.toastText(response.data.msg);
              } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
                //不不设置提示
              } else {
                that.toastError('系统错误');
              }
            }).catch(function (error) {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();
              that.toastError('系统错误');
            });
          } else if (['forderQacheck', 'forderWeigh',  'forderConfirm',  'Finance41',  'Pay41',  'FinalPay41'].includes(that.type)) {
            let model = that.model;
            let comns = {
              fileIds: that.fileids ? that.fileids.join(',') : '',
              id: that.id,
              opinion: that.opinion || '同意',
              taskid: that.nodeid
            };
            let postData = {...comns, ...that.model};
            that.axios({
              method: 'post',
              url: `${that.passUrl}?${qs.stringify(postData)}`,
              data: model
            }).then(response => {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();

              if (response.data.code == 200) {
                that.toastSuccess('提交成功!');
                that.$router.push({ path: that.navgateUrl })
              } else if (response.data.msg) {
                that.toastText(response.data.msg);
              } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
                //不不设置提示
              } else {
                that.toastError('系统错误');
              }
            }).catch(function (error) {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();
              that.toastError('系统错误');
            });
            console.log('postData.items:', postData.items)
          } else if (['sellDispatch', 'forderWhin'].includes(that.type)) {
            let model = that.model;
            let postData = {
              fileIds: that.fileids ? that.fileids.join(',') : '',
              id: that.id,
              opinion: that.opinion || '同意',
              taskid: that.nodeid
            };
            that.axios({
              method: 'post',
              url: `${that.passUrl}?${qs.stringify(postData)}`,
              data: model
            }).then(response => {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();

              if (response.data.code == 200) {
                that.toastSuccess('提交成功!');
                that.$router.push({ path: that.navgateUrl })
              } else if (response.data.msg) {
                that.toastText(response.data.msg);
              } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
                //不不设置提示
              } else {
                that.toastError('系统错误');
              }
            }).catch(function (error) {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();
              that.toastError('系统错误');
            });
            console.log('postData.items:', postData.items)
          } else {
            let postData = {
              fileIds: that.fileids ? that.fileids.join(',') : '',
              id: that.id,
              opinion: that.opinion || '同意',
              taskid: that.nodeid
            };
            console.log('通用审批')
            that.axios({
              headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},
              method: 'post',
              url: that.passUrl,
              data: qs.stringify(postData)
            }).then(response => {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();

              if (response.data.code == 200) {
                that.toastSuccess('提交成功!');
                that.$router.push({ path: that.navgateUrl })
              } else if (response.data.msg) {
                that.toastText(response.data.msg);
              } else if (response != undefined && response.data != undefined && response.data.msg == 'sessionTimeOut') {
                //不不设置提示
              } else {
                that.toastError('系统错误');
              }
            }).catch(function (error) {
              //恢复提交按钮可点击
              $('.weui-dialog__btn').attr('disabled', false).css("pointer-events","auto");
              //关闭提交状态
              $.hideLoading();
              that.toastError('系统错误');
            });
          }
          //$("#"+id).hide();
        }, function() {
          //点击取消后的回调函数
        });

      },
      isEmpty: function(domID) {
        return $('#' + domID).val() == "" || $('#' + domID) == null;
      }
    }
  }
</script>
